package com.example.demo.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.demo.bean.Article;
import com.example.demo.dao.ArticleDao;
import com.example.demo.service.IArticleService;

//表明这个类是一个服务类，并交给 ioc管理
@Service
public class ArticleServiceImpl implements IArticleService {
	
	//给引用属性赋值
	@Autowired
	private ArticleDao al;


	@Override
	public void addArticle(String title, String status) {
		// TODO Auto-generated method stub
		al.insertArticle(status, status);
	}
	

	@Override
	public void removeArticle(String title) {
		// TODO Auto-generated method stub
		al.deleteArticleByTitle(title);
		
	}

	@Override
	public void changeArticle(String status, String title) {
		// TODO Auto-generated method stub
		al.updateArticle(status, title);
		
	}

	
	@Override
	public List<Article> findAll() {
		// TODO Auto-generated method stub
		return al.selectAll();
	}

}

